package com.jia.train.seat.controller;

import com.jia.train.global.page.PageResponse;
import com.jia.train.global.response.BaseResponse;
import com.jia.train.seat.request.DailyTrainSeatQueryRequest;
import com.jia.train.seat.response.DailyTrainSeatQueryResponse;
import com.jia.train.seat.service.DailyTrainSeatService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/daily/train")
public class DailyTrainSeatController {

    @Resource
    private DailyTrainSeatService dailyTrainSeatService;

    @GetMapping("/query")
    public BaseResponse<PageResponse<DailyTrainSeatQueryResponse>> query(@Valid DailyTrainSeatQueryRequest request) {
        PageResponse<DailyTrainSeatQueryResponse> responseList = dailyTrainSeatService.selectPage(request);
        return new BaseResponse<>(responseList);
    }

    @DeleteMapping("/delete/{id}")
    public BaseResponse<String> delete(@PathVariable Long id) {
        dailyTrainSeatService.deleteDailyTrainSeat(id);
        return new BaseResponse<>("success");
    }

}
